package copy;

import java.io.File;

public class DeleteFolder
{
    public static void delete(File file)
    {
    	File[] files=file.listFiles();
    	for(int i=0;i<files.length;i++)
    	{
    		System.out.print(files[i].getPath());
    		if(files[i].isDirectory())delete(files[i]);
    		else files[i].delete();
    	}
    	file.delete();
    }
    static int lever = 0;
    public static void dirTree(String path) {
    	  File file = new File(path);
    	  if (!file.exists())
    	   System.out.println("Duong dan khong dung");
    	  if (!file.isFile()) {

    	   File[] list = file.listFiles();
    	  if (list != null) {
    	   lever++;
    	   for (File f : list) {
    	    dirTree(f.getAbsolutePath());
    	    }
    	    lever--;
    	   }
    	   
    	  }
    	 }
    
    public static void main(String arg[])
    {
    	delete(new File("D:\\copy"));
    }
}
